#ifndef __ILIB_TP_OTCP_H_201120325__
#define __ILIB_TP_OTCP_H_201120325__

#include "iConnection.h"
#include "iTPConnection.h"

/** @class Original TCP Connection wrapper
 *
 */
class iOTCPConnection : public iConnection
					  , public iTPConnection
{
public:
	friend class iListenConnection;
	iOTCPConnection(iSocket* so, iConnection* prvd, iAllocator* alloc);

    // override iConnection
    virtual void on_connect_confirm();
    virtual void on_data_indication(iMsgDB* mdb);
    virtual void on_close();

	// override iMsgProcessor
	virtual int on_message(iMsgID msg, void* param);

    // override iTPConnection
	virtual int32_t connect_request(iMsgDB* request,  iTPConnection::iSink* sink);
	virtual int32_t connect_response(iMsgDB* response,iTPConnection::iSink* sink);
	virtual int32_t close();
    virtual int32_t send_data(iMsgDB* data);
    virtual int32_t get_option(TP_OPTION, void* optval, int32_t optlen);
    virtual int32_t set_option(TP_OPTION, void* optval, int32_t optlen);
    virtual void release();

protected:
    iTPConnection::iSink*    m_sink;
    iMsgDB* m_data;
};

#endif  //__ILIB_TP_OTCP_H_201120325__
